<style scoped>
  .expand-row{
    margin-bottom: 16px;
  }
  .lyx-table-btn{
    margin-right: 5px;
    margin-bottom: 2px;
  }
</style>
<template>
  <div>
    <Button v-for="(item,index) in list" :key="index" @click="goRun(item.c, item.data)"
    :type="item.type" :size="item.size" class="lyx-table-btn">{{item.name}}</Button>
  </div>
</template>
<script>
import { itemParamByOrderList } from '@/api/eventlist'
export default {
  name: 'ExpandRow',
  data () {
    return {
      bwk: '0',
      paramsArr: [],
      list: []
    }
  },
  props: {
    params: Object
  },
  mounted () {
    this.rowList()
  },
  watch: {
    // params (ret) {
    //   console.log(ret)
    // }
  },
  methods: {
    async rowList () {
      let params = this.params
      let temp = []
      temp.push({ type: 'info', size: 'small', c: 1, data: params.row, name: '进度' })
      // if (params.row.state === '2') {
      //   if (params.row.item_id === '11210101000000RSJD5212000233000') {
      //     temp.push({ type: 'info', size: 'small', c: 9, data: params.row, name: '查看电子证' })
      //   }
      //   temp.push({ type: 'info', size: 'small', c: 2, data: params.row, name: '打印通知单' })
      // }
      // if (params.row.form_url) {
      //   temp.push({ type: 'info', size: 'small', c: 6, data: params.row, name: '打印表格' })
      // }
      // let action1 = evil('(' + params.row.action + ')')
      // for (let key in action1) {
      //   if (action1[key].type === 'button' && action1[key].next_process_id === '-1') {
      //     let key1 = ''
      //     let key2 = ''
      //     let acs = 3
      //     if (action1[key].params_type) {
      //       key1 = action1[key]
      //       key2 = key
      //       acs = 3
      //     } else {
      //       key1 = key
      //       key2 = action1[key]
      //       acs = 4
      //     }
      //     temp.push({ type: 'success', size: 'small', c: acs, data: { data: params.row, key1: key1, key2: key2 }, name: action1[key].name })
      //   }
      // }
      if (params.row.params && params.row.params !== '{}') {
        let param = { id: params.row.item_id, code: params.row.code }
        let ax = await itemParamByOrderList(param)
        this.paramsArr = ax.data.data
        for (let i = 0; i < this.paramsArr.length; i++) {
          if (this.paramsArr[i].write_type === 'images') {
            temp.push({ type: 'info', size: 'small', c: 5, data: this.paramsArr[i].img_url, name: '查看' + this.paramsArr[i].name })
          }
        }
      }
      this.list = temp
    },
    goRun (type, data) {
      this.$emit('breachRun', type, data)
    }
  }
}
</script>
